<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>test</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


</HEAD>

<BODY>
<%
	set db=server.CreateObject("adodb.connection")
	set rs=server.CreateObject("adodb.recordset")
	set nonRS=server.CreateObject("adodb.recordset")
	
	logfile=server.mappath ("access/backend/tickets.mdb")
	db.open ("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & logfile)
	
	sql="select ticket_id, contract_id, status, Created_time, Given_To, Dispatched_Time, appliance, emergency, follow_up from tickets where (created_time between #10/28/2009 6:00# and #10/28/2009 7:00#)"
	rs.open sql,db,1,2
	
	nonSQL="select * from non_homesmart_customers where contract_id in ('NHS437')"
	nonRS.open nonSQL,db,1,2
	'logrs.open logsql,logconn,1,2
	'set rs=db.execute (sql)
	
	response.Write("<table border='1'>")

	response.Write("<tr>")
	for x=0 to rs.fields.count-1
		response.Write("<td>" & rs.fields(x).name & "</td>")
	next
	for x=0 to nonRS.fields.count-1
		response.Write("<td>" & nonRS.fields(x).name & "</td>")
	next	
	response.Write("<tr>")
	
	if not rs.eof then 
		do until rs.eof
			response.Write("<tr>")
			for x=0 to rs.fields.count-1
				response.Write("<td>" & rs(x) & "</td>")
			next
			for x=0 to nonRS.fields.count-1
				response.Write("<td>" & nonRS(x) & "</td>")
			next
			rs.movenext
			nonRS.movenext
			response.Write("</tr>")
		loop
	end if
	
	response.Write("</table>")
	
	response.Write("<br>")
	response.Write(sql)
	response.Write("<br>")
	response.Write(rs.recordcount)
	
	db.close
	set logrs=nothing
	set db=nothing


%>
<br>
done
</BODY>
</HTML>

